#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<unistd.h>
#include<sys/types.h>
#include<sys/socket.h>
#include<netinet/in.h>
#include <arpa/inet.h>
#include <iostream>
#include <time.h>

using namespace std;

int main(int argc, char *argv[])
{
    int sockfd=socket(AF_INET,SOCK_DGRAM,0);
    if(sockfd==-1)
    {
        cout<<"creat socket false"<<endl;
        return -1;
    }

    struct sockaddr_in server_addr;
    server_addr.sin_family=AF_INET;
    server_addr.sin_port=htons(5001);
    server_addr.sin_addr.s_addr=inet_addr("192.168.1.63");

    char buf[128];

    while(1)
    {
       buf[0]='l';
       sendto(sockfd,buf,sizeof(buf),0,(const struct sockaddr *)(&server_addr),sizeof(server_addr));
       cout<<"sent the l to"<<inet_ntoa(server_addr.sin_addr)<<endl;
       sleep(1);
    }

    return 0;
}
